﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Windows.Forms.Integration;

namespace UWCSE.CompleterVSPackage
{
    public partial class QueryForm : Form
    {
        private readonly QueryControl queryControl;
        private readonly ElementHost host;

        public QueryForm()
        {
            InitializeComponent();
        }

        public QueryForm(QueryControl queryControl) : this()
        {
            this.SuspendLayout();

            this.queryControl = queryControl;
            this.Controls.Clear();
            host = new ElementHost();
            host.Dock = DockStyle.Fill;
            host.Child = queryControl;
            this.Controls.Add(host);

            this.ResumeLayout(false);
        }

        private void QueryForm_FormClosed(object sender, FormClosedEventArgs e)
        {
            queryControl.NotifyFormClosed();
        }
    }
}
